package cn.openread.demo.algorithm.p1;

/**
 * 用途:一切为了业务
 *
 * @author simon
 * @date 2019-12-23 15:53
 */
public class P1Main {

    public static void main(String[] args) throws InterruptedException {
        Foo foo = new Foo();

        Thread n1 = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    foo.first(() -> {
                        System.out.println("first");
                    });
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });

        Thread n2 = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    foo.third(() -> {
                        System.out.println("third");
                    });
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });

        Thread n3 = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    foo.second(() -> {
                        System.out.println("second");
                    });
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });

        n1.start();
        n2.start();
        n3.start();
    }
}
